//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Example #14—String Class Example
// CS 151, 6 Apr 2009
// ECC, Spring 2009
// Niko Culevski
// Program to demonstrate the indexOf() method
// of the String class
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class SearchingForChars
{
    public static void main(String args[ ])
    {
        String str = "This is the Mississippi River.";
        System.out.println(str);    // display string

        //one version of indexOf() method
        int i = str.indexOf('s');
        System.out.println("The first index of 's' is " + i);

        //overloaded version of indexOf() method
        int j = str.indexOf('s', i+1);
        System.out.println("The next index of 's' is " + j);
        int k = str.indexOf('s', j + 1);
        System.out.println("The next index of 's' is " + k);
        k = str.lastIndexOf('s');
        System.out.println("The last index of 's' is " + k);
        System.out.println(str.substring(k));
        System.out.println(str.toLowerCase());
        System.out.println(str.toUpperCase());
    }
}
